gh-89152: Note truth testing exception in stdtypes.rst#137640
gh-89152: Note truth testing exception in stdtypes.rst#137640JelleZijlstra merged 7 commits intopython:mainfrom
stdtypes.rst#137640Conversation
ZeroIntensity
left a comment
There was a problem hiding this comment.
As currently written, I'm not sure this is an improvement. I don't think NotImplemented should be special here, because it's pretty easy to implement something yourself that also fails as a truth value:
class Test:
def __bool__(self):
raise TypeError
if Test(): # TypeError
passWe should do one of two things:
- Do nothing -- it's probably fine as-is.
- Note here that objects can raise exceptions in their
__bool__method, and perhaps point toNotImplementedas an example.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I have made the requested changes; please review again (I have made @JelleZijlstra suggested changes.) |
|
Thanks for making the requested changes! @ZeroIntensity: please review the changes made to this pull request. |
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
Only backport to 3.14, right? |
|
Yep! |
|
Thanks @StanFromIreland for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…nGH-137640) (cherry picked from commit 3c0888b) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
GH-143081 is a backport of this pull request to the 3.14 branch. |
…37640) (#143081) gh-89152: Note truth testing exception in `stdtypes.rst` (GH-137640) (cherry picked from commit 3c0888b) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This was implemented in 3c079a0
📚 Documentation preview 📚: https://cpython-previews--137640.org.readthedocs.build/